<template>
  <div class="home">
    <Header />
    <HomeSwiper :list="swiperList" />
    <HomeIcon :list="iconList" />
    <HomeRecommend :list="recommendList" />
    <HomeWeekend :list="weekendList" />
  </div>
</template>

<script>
import Header from './components/Header';
import HomeSwiper from './components/Swiper';
import HomeIcon from './components/Icon';
import HomeRecommend from './components/Recommend';
import HomeWeekend from './components/Weekend';
import axios from 'axios';
export default {
  name: 'Home',
  components: {
    Header,
    HomeSwiper,
    HomeIcon,
    HomeRecommend,
    HomeWeekend
  },
  data () {
    return {
      city: '',
      swiperList: [],
      iconList: [],
      recommendList: [],
      weekendList: []
    };
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then((res) => {
          // console.log(res);
          let data = res.data;
          if (data.ret && res.data) {
            this.swiperList = data.data.swiperList;
            this.iconList = data.data.iconList;
            this.recommendList = data.data.recommendList;
            this.weekendList = data.data.weekendList;
          }
        });
    }
  },
  mounted () {
    this.getHomeInfo();
  }
};
</script>

<style lang="stylus" scoped>
</style>
